﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;

namespace Sqlite.Core.Demo.Models
{
    public class ApplicationDbContext : DbContext
    {
        public DbSet<User> Users { get; set; }
        public DbSet<Data> Datas { get; set; }

        public string DbPath { get; }

        public ApplicationDbContext()
        {
            //var folder = Environment.SpecialFolder.LocalApplicationData;
            //var path = Environment.GetFolderPath(folder);
            //DbPath = System.IO.Path.Join(path, "Application.db");
            //DbPath = System.IO.Path.Join(Environment.CurrentDirectory, "Application.db");
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);
            //string path = System.IO.Path.Join(Environment.CurrentDirectory, "Application.db");
            //
            //var folder = Environment.SpecialFolder.LocalApplicationData;
            //var path2 = Environment.GetFolderPath(folder);
            //var DbPath = System.IO.Path.Join(path2, "blogging.db");


            optionsBuilder.UseSqlite($"Data Source = app.db");
        }
    }
}
